package org.graduates.webapp.actions.course.json;

import java.util.ArrayList;
import java.util.List;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import org.graduates.webapp.actions.BaseAction;
import org.projects.graduates.domain.Course;
import org.projects.graduates.domain.Teaching;

import com.opensymphony.xwork2.ActionSupport;

/**
 * 获取当前用户的所有在教课程
 * 
 * @author Administrator
 * 
 */
@ParentPackage("web")
public class GetTeachingsAction extends BaseAction {
	private static final long serialVersionUID = -8314043793413978608L;

	private List<Course> courses = new ArrayList<Course>();

	@Action(results = { @Result(name = "success", type = "json") })
	public String execute() {
		courses.addAll(Teaching.findBy(getCurrentPerson()));
		return ActionSupport.SUCCESS;
	}

	public List<Course> getCourses() {
		return courses;
	}

	public void setCourses(List<Course> courses) {
		this.courses = courses;
	}

}
